/**
 * 
 */
function clearTarget(target) {
	document.getElementById(target).innerHTML="<br />";
	}
function doValidate() {
	var title = document.getElementById("title");
	var desc = document.getElementById("description");
	var tags = document.getElementById("inputString");
	var flag=true;
	var NAME_PATTERN =/[^<>]+$/;
	if( tags.value == null || tags.value.trim() == "" ) {
		document.getElementById("tags_error").innerHTML = "Please specify atleast one tag.";
		document.getElementById("tags_error").style.color="red";
		flag=false;
	}
	 else{
		 var result=NAME_PATTERN.test(tags.value);
		 if(result==false){
					document.getElementById("tags_error").innerHTML = "Enter valid tags";
					document.getElementById("tags_error").style.color="red";
					flag=false;
		 }else{
			 document.getElementById("tags_error").innerHTML = "";
		 }
			
	}
	if(title.value == null || title.value == "") {
		document.getElementById("title_error").innerHTML = "Title cannot be left empty";
		document.getElementById("title_error").style.color="red";
		flag=false;
	}else if(title.value.trim().length<5){
	 	document.getElementById("title_error").innerHTML = "Enter title more than 5 letters";
	 	document.getElementById("title_error").style.color="red";
		flag=false;
	}else{
		 var result=NAME_PATTERN.test(title.value);
		if(result==false){
			document.getElementById("title_error").innerHTML = "Enter valid title";
			document.getElementById("title_error").style.color="red";
			flag=false;
		}else{
			document.getElementById("title_error").innerHTML = "";
		}
		
	}
	//alert(flag);
	return flag;
	/*if(flag==true) {
		document.forms["theForm"].submit();
	}*/ 
}
/**
 * function for checking if the search string is empty
 * @returns {Boolean}
 */
function searchValidate(){
	var searchString = document.getElementById("query").value;
	if(searchString.trim() == null || searchString.trim() == "") {
		
		return false;
	}
	return true;	
}

/**
 * validation script for Afterregistration.jsp page
 * @returns {Boolean}
 */
function validateEmailId(){
	var isValidate=false;
	
	if(document.getElementById("email").value.trim()==""){
		document.getElementById("fw-error").innerHTML="Enter emailId";
		document.getElementById("email").style.background="#ffebeb";
		document.getElementById("email").style.border="1px solid #e2000d";
		isValidate= false;
	}else{
			var pattern=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9][a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;  
			var result=pattern.test(document.getElementById("email").value);
			if(result==false){
				document.getElementById("fw-error").innerHTML="Enter valid emailId";
				document.getElementById("email").style.background="#ffebeb";
				document.getElementById("email").style.border="1px solid #e2000d";
				isValidate= false;
			}else{
				document.getElementById("fw-error").innerHTML="";
				document.getElementById("email").style.background="white";
				document.getElementById("email").style.border="0px";
				isValidate= true;
			}
	}
	return isValidate;
}
function onValidate(){
document.getElementById("fw-error").innerHTML="";
document.getElementById("email").style.background="white";
document.getElementById("email").style.border="0px";
}
function validatePassword(){
	if(document.getElementById("newpassword").value!=document.getElementById("confirmpassword").value){
		document.getElementById("passwordmsg").innerHTML="New Password and ConfirmPassword must be same";
		return false;
	}else{
		if(document.getElementById("newpassword").value.length<6){
			document.getElementById("passwordmsg").innerHTML="Password length atleast 6 character";
			return false;
		}else{
			return true;
		}
	}
}